package com.freshmarket.freshmarket.controller;


import com.freshmarket.freshmarket.entity.Storefront;
import com.freshmarket.freshmarket.service.IStorefrontService;
import com.freshmarket.freshmarket.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Squirrel
 * @since 2020-09-04
 */
@RestController
@RequestMapping("/freshmarket/storefront")
public class StorefrontController {
    @Autowired
    private IStorefrontService storefrontService;

    @GetMapping("getStorefront")
    public Result getStorefront() {
        List<Storefront> storefronts = storefrontService.list();
        return Result.successResult(storefronts);
    }

    @RequestMapping("/selectAddress")
    public Result selectAddress(String address) {
        Storefront storefront = storefrontService.selectAddress(address);
        return Result.successResult(storefront);
    }
}

